package com.vector.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.time.Instant;
import java.util.Date;

/**
 * 文件上传
 */
@Controller
public class FileUploadController {
    /**
     * 文件上传
     */
    @RequestMapping("/fileUploadController")
    public String fileUpload(MultipartFile file)throws Exception{
        String fileName = file.getOriginalFilename();
        System.out.println(fileName);
        file.transferTo(new File("c:/"+ " " +file.getOriginalFilename()));
        return "OK";
    }

}